Fix #3107. rustdoc without --target if compiled for host
authorPhaiax <phaiax-git@invisibletower.de>
Sun, 25 Sep 2016 12:10:01 +0000 (14:10 +0200)
committerPhaiax <phaiax-git@invisibletower.de>
Sun, 25 Sep 2016 12:10:01 +0000 (14:10 +0200)
src/cargo/ops/cargo_rustc/mod.rs

index b36ed3cebd14ab52a784a96215de750e81013013..d6ba15480849c71c4e3e1b01d6ff15c1c110d7da 100644 (file)
@@ -402,8 +402,10 @@ fn rustdoc(cx: &mut Context, unit: &Unit) -> CargoResult<Work> {
            .cwd(cx.config.cwd())
            .arg("--crate-name").arg(&unit.target.crate_name());
 
-    if let Some(target) = cx.requested_target() {
-        rustdoc.arg("--target").arg(target);
+    if unit.kind != Kind::Host {
+        if let Some(target) = cx.requested_target() {
+            rustdoc.arg("--target").arg(target);
+        }
     }
 
     let doc_dir = cx.out_dir(unit);